import { request } from '@utils/http'
import { IDepartmentList, IDictList, IDoctorList, IHospitalDetailResponse, IHospitalListParams, IHospitalListResponse, IScheduleResponse } from './model/hospitalListTypes'
/**
 * 根据父级id获取 省市区列表数据
 * @param id 
 * @returns 
 */
export const getDictList = (id: string | number) => {
    return request.get<any, IDictList>('/admin/cmn/dict/findByParentId/' + id)
}
/**
 * 获取医院列表分页数据
 * @param param0 
 * @returns 
 */
export const getHospitalList = ({ page, limit, hoscode, hosname, hostype, provinceCode, cityCode, districtCode, status }: IHospitalListParams) => {
    return request.get<any, IHospitalListResponse>(`/admin/hosp/hospital/${page}/${limit}`, {
        params: {
            hoscode,
            hosname,
            hostype,
            provinceCode,
            cityCode,
            districtCode,
            status
        }
    })
}
/**
 * 改变指定医院的上线下状态
 * @param id 
 * @param status 
 * @returns 
 */
export const changeStatus = (id: string, status: number) => {
    return request.get<any, null>(`/admin/hosp/hospital/updateStatus/${id}/${status}`)
}
/**
 * 获取医院详情数据
 * @param id 
 */
export const getHospitalDetail = (id: string | number) => {
    return request.get<any, IHospitalDetailResponse>('/admin/hosp/hospital/show/' + id)
}

/**
 * 根据医院编号，获取医院科室列表
 * @param hoscode 
 * @returns 
 */
export const getDepartmentList = (hoscode:string)=>{
    return request.get<any, IDepartmentList>('/admin/hosp/department/' + hoscode)
}
/**
 * 获取科室排班日期列表数据
 * @param page 
 * @param limit 
 * @param hoscode 
 * @param depcode 
 * @returns 
 */
export const getScheduleList = (page:number, limit:number,hoscode:string, depcode:string)=>{
    return request.get<any, IScheduleResponse>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}
/**
 * 排班医生列表数据
 * @param hoscode 
 * @param depcode 
 * @param workDate 
 * @returns 
 */
export const getDoctorList = (hoscode:string, depcode:string, workDate:string)=>{
    return request.get<any, IDoctorList>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
}